#include <iostream>
using namespace std;


struct mem{
	int left,right,index;
};


int main(){
	int n,m;
	cin>>n>>m;
	mem a[n];
	for(int i=0;i<n;i++){
		a[i].index = i+1;
		a[i].left = (i-1+n)%n;
		a[i].right = (i+1)%n;
	}
	int index=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			index = a[index].right;
		}
		cout<<a[a[index].left].index<<" ";
		a[a[a[index].left].left].right = index;
		a[index].left = a[a[index].left].left;
	}
	return 0;
}
